package com.gimi.cloud.jimi.manage.controller.order;


import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gimi.cloud.jimi.common.enums.ResponseCodeEnum;
import com.gimi.cloud.jimi.common.utils.JsonUtil;
import com.gimi.cloud.jimi.common.utils.reqhead.Response;
import com.gimi.cloud.jimi.common.utils.reqhead.Util;
import com.gimi.cloud.jimi.dto.order.OrderCostDTO;
import com.gimi.cloud.jimi.manage.service.order.OrderCostService;
                                                                                                                                                                                                                     /**
 * 订单管理
 * @author chendi
 * @date 2018年1月12日
 */
@RestController
@RequestMapping(value = "orderCost")
public class OrderCostController {
	
	@Autowired
    private OrderCostService orderCostService;
	
	/** 获得单个订单费用信息 */
    @RequestMapping(value = "/getSingleOrderCost")
    public void getSingleOrderCost(@RequestBody OrderCostDTO DTO, HttpServletResponse response) throws Exception {
    	Response resp = new Response();
    	OrderCostDTO orderCost = orderCostService.getSingleOrderCost(DTO);
    	resp.setRes_data(orderCost);
        resp.setResponseCode(ResponseCodeEnum.SUCCESSED);
        Util.sendResponse(JsonUtil.toJSONStringWithDateFormatYYYYMMDDHHMMSS(resp), response);
    }
    
    
    /** 修改订单订单费用信息 */
    @RequestMapping(value = "/updateOrderCost")
    public void updateOrderCost(@RequestBody OrderCostDTO DTO, HttpServletResponse response) throws Exception {
    	Response resp = new Response();
    	orderCostService.updateOrderCost(DTO);
    	resp.setResponseCode(ResponseCodeEnum.SUCCESSED);
    	Util.sendResponse(JsonUtil.toJSONStringWithDateFormatYYYYMMDDHHMMSS(resp), response);
    }
    /**删除订单费用信息**/
    @RequestMapping(value = "/deleteOrderCost")
    public void deleteOrderCost(@RequestBody OrderCostDTO DTO, HttpServletResponse response) throws Exception {
    	Response resp = new Response();
    	orderCostService.deleteOrderCost(DTO);
    	resp.setResponseCode(ResponseCodeEnum.SUCCESSED);
    	Util.sendResponse(JsonUtil.toJSONStringWithDateFormatYYYYMMDDHHMMSS(resp), response);
    }
    
    
}
